package com.jt.controller;

import com.jt.pojo.ContentCategory;

import com.jt.pojo.Node;
import com.jt.service.ContentCategoryService;
import com.jt.vo.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/content/category/")
public class ContentCategoryController {
    @Autowired
    ContentCategoryService contentCategoryService;

    @RequestMapping("list")
    public List<Node> getContentCategory(Long id){
        return contentCategoryService.getContentCategory(id);
    }

    @RequestMapping("create")
    public JsonResult saveContenCategory(ContentCategory contentCategory){
        return new JsonResult(contentCategoryService.save(contentCategory));
    }

    @RequestMapping("delete")
    public JsonResult deleteConteneCategort(Long id){
        return new JsonResult(contentCategoryService.deleteContentCategoryByid(id));
    }

    @RequestMapping("update")
    public JsonResult updateCOntentCategory(ContentCategory contentCategory){
        return new JsonResult(contentCategoryService.updateContentCategory(contentCategory));
    }
}
